import { Text, View } from '@react-pdf/renderer';

const Watermark = () => {
  const watermarkText = `${new Date().getFullYear()} © 公司机密`;
  const rows = 6; // 纵向行数
  const cols = 3; // 横向列数

  return (
    <View style={{
      position: 'absolute',
      top: 0,
      left: 0,
      width: '100%',
      height: '100%',
      zIndex: -1,
      flexDirection: 'row',
      flexWrap: 'wrap'
    }}>
      {Array.from({ length: rows * cols }).map((_, i) => (
        <Text
          key={i}
          style={{
            width: `${100 / cols}%`,
            height: `${100 / rows}%`,
            fontSize: 20,
            color: '#999',
            opacity: 0.2,
            transform: 'rotate(-30deg)',
            textAlign: 'center',
            paddingTop: 20 // 调整垂直位置
          }}
        >
          {watermarkText}
        </Text>
      ))}
    </View>
  );
};

export default Watermark;